﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnvDTE;
using EnvDTE80;

namespace BovespaMaintainabilityRules
{
    public sealed class Rule_DoNotDeclareTooManyParameters : BaseAddIn.Rules.BaseRuleAddIn
    {
        #region Constructor

        public Rule_DoNotDeclareTooManyParameters()
            : base("BovespaDoNotDeclareTooManyParameters", "BovespaMaintainabilityRules.BovespaMaintainabilityRules", typeof(Rule_DoNotDeclareTooManyParameters).Assembly)
        {
        }

        #endregion

        #region Protected Override Methods

        protected sealed override void Check(CodeFunction funcao, CodeNamespace namespaceElement, CodeClass2 classe)
        {
            if (funcao.Parameters != null
                && funcao.Parameters.Count > 10)
            {
                GeraProblemaAddIn(funcao.StartPoint.Parent.Parent.FullName,
                                  funcao.StartPoint.Line,
                                  funcao.StartPoint.DisplayColumn,
                                  "DoNotDeclareTooManyParametersResolution",
                                  classe.Name,
                                  funcao.Name,
                                  namespaceElement.Name);
            }
        }

        #endregion
    }
}
